package com.gopay.common.trace.enums;

/**
 * @author ddh02
 * @LogType
 * @2017/3/30 17:27  www.gopay.com.cn Inc.All rights reserved.
 */


public enum TraceType {
    NO("NO"),

    SPRING_MVC("T-S"),

    RPC("T-R"),

    LOCAL("T-L"),

    HTTP_CLIENT("T-H"),

    ORDER_SAVE("O-S"),

    ORDER_UPDATE("O-U"),

    //add by zyt，2017-12-1，下面两个，BO-S代表类型为银行订单的插入，BO-U代表类型为银行订单的更新
    BISORDER_SAVE("BO-S"),

    BISORDER_UPDATE("BO-U")
    ;

    private String value;

    TraceType(String type) {
        this.value = type;
    }

    public static TraceType get(String value){
        if("T-S".equals(value)){
            return TraceType.SPRING_MVC;
        }
        if("T-R".equals(value)){
            return TraceType.RPC;
        }
        if("T-L".equals(value)){
            return TraceType.LOCAL;
        }
        if("T-H".equals(value)){
            return TraceType.HTTP_CLIENT;
        }
        if("O-S".equals(value)){
            return TraceType.ORDER_SAVE;
        }
        if("O-U".equals(value)){
            return TraceType.ORDER_UPDATE;
        }
        return TraceType.NO;
    }

    @Override
    public String toString() {
        return value;
    }

}
